home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
COMAL
/
B-Book Series
/
(k)b4.d64
/
solution8.15
< prev
next >
Wrap
Text File
|
2007-02-28
|
1KB
|
44 lines
0010 DIM TEXT$ OF 500, CH$ OF 1, BUF$ OF 80
0020 GETTEXT
0030 PRINT ARI
0040 //
0050 PROC GETTEXT
0060 TEXT$:=" "
0070 FOR LINE:=1 TO 6 DO
0080 READ BUF$
0090 TEXT$:=TEXT$+BUF$
0100 ENDFOR LINE
0110 COMPUTE(TEXT$,INDEX)
0120 ARI:=INDEX
0130 ENDPROC GETTEXT
0140 //
0150 PROC COMPUTE(TEXT$,REF ARI)
0160 COUNT:=0; POINT:=1; DOTCOUNT:=0; LETTERCOUNT:=0
0170 CH$:=TEXT$(POINT)
0180 WHILE CH$<>"*" DO
0190 WORD:=FALSE
0200 WHILE CH$<>"*" AND (CH$<"A" OR CH$>"Z") DO
0210 IF CH$="." THEN DOTCOUNT:=DOTCOUNT+1
0220 POINT:=POINT+1
0230 CH$:=TEXT$(POINT)
0240 ENDWHILE
0250 WHILE CH$>="A" AND CH$<="Z" DO
0260 POINT:=POINT+1
0270 CH$:=TEXT$(POINT)
0280 LETTERCOUNT:=LETTERCOUNT+1
0290 WORD:=TRUE
0300 ENDWHILE
0310 IF WORD THEN COUNT:=COUNT+1
0320 ENDWHILE
0330 AVSENT:=COUNT/DOTCOUNT
0340 AVWORD:=LETTERCOUNT/COUNT
0350 ARI:=.5*AVSENT+4.71*AVWORD-15.43
0360 ENDPROC COMPUTE
0370 //
0380 DATA "ONCE YOU CAN APPLY THE USE OF PROCEDURES"
0390 DATA "INTELLIGENTLY TO YOUR COMPUTING PROBLEMS, A"
0400 DATA "WHOLE NEW WORLD OPENS UP; POWER AT YOUR"
0410 DATA "FINGERTIPS! - BRAILSFORD AND WALKER"
0420 DATA "INTRODUCTORY ALGOL 68 PROGRAMMING."
0430 DATA "ELLIS HORWOOD, 1979.*"